﻿@model IEnumerable<Article>
@{
    Ajax.Dna().Widget()
        .Preview(@<text>
    <ul class="d-post-items">
        <li><a href="javascript:void(0);">Recent post title1</a></li>
        <li><a href="javascript:void(0);">Recent post title2</a></li>
        <li><a href="javascript:void(0);">Recent post title3</a></li>
        <li><a href="javascript:void(0);">Recent post title4</a></li>
        <li><a href="javascript:void(0);">Recent post title5</a></li>
    </ul>
    </text>)
        .Content(@<text>
    <ul class="d-post-items">
        @foreach (var art in Model)
        {
            var article = new ArticleWrapper(art);
            if (!article.IsVisible(Context))
            {
                continue;
            }
            <li><a href="@article.PermaLink" title="@(string.IsNullOrEmpty(article.Summary) ? article.Title : Html.Encode(article.Summary))">
                @((item.GetInt("TextLen")) > -1 ? Html.Cut(article.Title, item.GetInt("TextLen")) : article.Title)</a>
                @if (item.GetBool("ShowAuthor"))
                {
                    <span style="float: right;">by
                        @Html.UserLink(article.UserName) </span>
                }
                @if (item.GetBool("ShowDate"))
                {
                    <span style="float: right; margin-right: 5px;">
                        @article.Posted.ToShortDateString() </span>
                }
            </li>
        }
    </ul>
    </text>)
        .Render();
}
